#pragma once

class CGameObject
{
public:
    enum GAMEOBJECT_TYPES
    {
        eDOOR			   = 0,
        eBUTTON			 = 1,
        eQUESTGIVER		 = 2,
        eCHEST			  = 3,
        eBINDER			 = 4,
        eGENERIC			= 5,
        eTRAP			   = 6,
        eCHAIR			  = 7,
        eSPELL_FOCUS		= 8,
        eTEXT			   = 9,
        eGOOBER			 = 10,
        eTRANSPORT		  = 11,
        eAREADAMAGE		 = 12,
        eCAMERA			 = 13,
        eMAP_OBJECT		 = 14,
        eMO_TRANSPORT	   = 15,
        eDUEL_ARBITER	   = 16,
        eFISHINGNODE		= 17,
        eRITUAL			 = 18,
        eMAILBOX			= 19,
        eAUCTIONHOUSE	   = 20,
        eGUARDPOST		  = 21,
        eSPELLCASTER		= 22,
        eMEETINGSTONE	   = 23,
        eFLAGSTAND		  = 24,
        eFISHINGHOLE		= 25,
        eFLAGDROP		   = 26,
        eMINI_GAME	= 27,
        eLOTTERY_KIOSK	= 28,
        eCAPTURE_POINT	= 29,
        eAURA_GENERATOR	= 30,
        eDUNGEON_DIFFICULTY	= 31,
        eBARBER_CHAIR	= 32,
        eDESTRUCTIBLE_BUILDING	= 33,
        eGUILD_BANK	= 34,
        eTRAPDOOR	= 35,
    };
    sGuid m_Guid;
    cGameObject mInstance;
public:
    CGameObject(){}
    CGameObject(sGuid guid)
    {
        m_Guid = guid;
        mInstance.Update( (DWORD*)CWowFun::GuidToPoint(guid) );
    }
    CGameObject(const CGameObject&T)
    {
        m_Guid = T.m_Guid;
        UpdateData();
    }
    CGameObject& operator = (const CGameObject&T)
    {
        m_Guid = T.m_Guid;
        UpdateData();
        return *this;
    }
    void UpdateData()
    {
        mInstance.Update( (DWORD*)CWowFun::GuidToPoint(m_Guid) );
    }
    sGuid GetGuid() const
    {
        return m_Guid;
    }
    sPos GetPos() const
    {
        return mInstance.Position();
    }
    bool IsHerb() const
    {
        return GET_DB().m_bHerb && (mInstance.GameSubType()==2);
    }
    bool IsMine() const
    {
        return GET_DB().m_bMine && (mInstance.GameSubType()==3);
    }
    bool IsBox() const
    {
        return GET_DB().m_bBox && (mInstance.GameSubType()==0);
    }
    bool IsFish() const
    {
        return mInstance.IsFishHooked();
    }
    DWORD GameType() const
    {
        return mInstance.GameType();
    }
    DWORD Distance() const;
    static bool SortByDis(CGameObject& A, CGameObject& B);
};